[extension.ai.agent] adopt unified awesome-azd templates.json manifest#7921
Conversation
…na/agent-init-templates-json
There was a problem hiding this comment.
Pull request overview
Updates the azd ai agent init template catalog consumer in the azure.ai.agents extension to read from the unified awesome-azd templates.json manifest and select only entries marked as agent-init templates via templateType: "extension.ai.agent".
Changes:
- Updates the
AgentTemplateschema to match the unified manifest (languages[],extensionFramework,templateType), and filters fetched entries bytemplateType. - Splits template fetching into a production wrapper + URL-injectable helper for tests.
- Updates language token for C# to
dotnetCsharpand matches templates viaslices.Containsacross multi-language entries.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_templates_helpers.go | Aligns template model to unified manifest, filters by templateType, updates language selection/matching and label framework field. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_templates_helpers_test.go | Updates fetch tests to validate templateType filtering and new schema fields; adds a gallery-only manifest case. |
jongio
left a comment
There was a problem hiding this comment.
Clean change. The fetch refactor (URL-injectable + post-unmarshal filter) is straightforward, filtering logic handles edge cases correctly (slices.Contains on nil is safe), and test coverage for the new filtering behavior is solid.
One optional nit: the Tags field name could be ExtensionTags to match ExtensionFramework naming - but since the field isn't referenced anywhere in the extension today, it's purely cosmetic. Up to you.
The coordinated cutover plan (redirect repoint + immediate CLI release) addresses the backward compat risk well.
trangevi
left a comment
There was a problem hiding this comment.
I've asked @therealjohn to take a look at this and make sure it's holding to what we've currently got
There was a problem hiding this comment.
Great! Needs to be paired with a merge of Azure/awesome-azd#841 and update the aka.ms link to point to the unified template.json
wbreza
left a comment
There was a problem hiding this comment.
Code Review: PR #7921
TL;DR
Updates �zd ai agent init to consume the unified awesome-azd emplates.json manifest. Clean function split for testability, good filtering logic, modern Go idioms throughout. A few hardening suggestions below — nothing blocking.
🟡 Medium (3 findings)
1. Consider a more descriptive error when filtering eliminates all templates
etchAgentTemplatesFromURL filters by emplateType == "extension.ai.agent". If the manifest has entries but none match, the downstream "no agent templates available" error doesn't reveal the filter mismatch — worth including the count fetched vs. matched for transition-period debugging.
2. Missing response body size limit
io.ReadAll(resp.Body) has no size cap. While the URL is a hardcoded �ka.ms endpoint, adding io.LimitReader(resp.Body, 1010241024) is defensive best practice.
3. No debug logging when templates are filtered out
During the awesome-azd#841 transition, silent filtering makes it hard to diagnose "templates disappeared" issues. A debug log after filtering (e.g., "fetched %d entries, %d matched templateType") would help.
🟢 Low (4 findings)
4. Language filter missing pre-allocation — �ar filtered []AgentTemplate in promptAgentTemplate doesn't pre-allocate, unlike the templateType filter. Minor consistency fix: make([]AgentTemplate, 0, len(templates)).
5. Gosec nolint comment could reference specific rule — e.g., //nolint:gosec // G107: URL is the hardcoded agentTemplatesURL constant or a local httptest server.
6. Test: assert TemplateType on second result —
esult[1].TemplateType isn't asserted. Minor gap alongside the existing
esult[0] assertion.
7. Test: empty Languages edge case — No test for templates with languages: []. Behavior is correct (slices.Contains returns false), but documenting it in tests would strengthen coverage.
✅ What Looks Good
- Clean etchAgentTemplates → etchAgentTemplatesFromURL split eliminates test helper duplication
- Modern Go: slices.Contains, .Context(), pre-allocated filtering
- Good mixed-manifest test coverage (gallery + agent + future extension types)
- Solid error wrapping with %w throughout
| Priority | Count |
|---|---|
| Critical | 0 |
| High | 0 |
| Medium | 3 |
| Low | 4 |
| Total | 7 |
JeffreyCA
left a comment
There was a problem hiding this comment.
Great! Needs to be paired with a merge of Azure/awesome-azd#841 and update the aka.ms link to point to the unified template.json
@therealjohn / @trangevi How concerned are we about the aka.ms link change breaking older extension versions? Users on older versions may see this error when trying to browse the templates:
A safer approach might be to keep the existing aka.ms link pointing to the same file, then use a new aka.ms link or use https://azure.github.io/awesome-azd/templates.json
How about updating the link to https://azure.github.io/awesome-azd/templates.json. Then after updating the aka.ms link, open a PR to change back to aka.ms? |
Yes that would work |
jongio
left a comment
There was a problem hiding this comment.
Clean migration to the shared awesome-azd manifest. The filtering logic is straightforward, slices.Contains on Languages handles nil safely, and the error-on-empty-filter is a solid guard for the transition period. Test coverage with mixed manifests validates the discriminator filtering well.
One tiny nit (non-blocking): the log.Printf format says 'fetched %d' but that's the filtered count - 'matched %d' might read slightly clearer. Not worth a change.
#7921) * fix 7920 * address feedback Co-authored-by: therealjohn <1501196+therealjohn@users.noreply.github.com>

Fixes #7920
Summary
Updates
azd ai agent initto consume the unified awesome-azdtemplates.jsonmanifest landed in awesome-azd#841. Agent-init templates are now identified by thetemplateType: "extension.ai.agent"discriminator within the shared manifest.Changes
init_from_templates_helpers.goAgentTemplateschema:Languages []string,ExtensionFramework string,TemplateType string(replaces singularLanguage/Framework).templateTypeExtensionAIAgent = "extension.ai.agent".fetchAgentTemplates(production) +fetchAgentTemplatesFromURL(URL-injectable, used by tests). Post-unmarshal filter keeps onlyextension.ai.agententries.csharp→dotnetCsharp(matches awesome-azdlanguagestoken).slices.Contains(t.Languages, …); label usest.ExtensionFramework.init_from_templates_helpers_test.goTestFetchAgentTemplates:success filters by templateType— mixed manifest (agent + gallery + future-extension entries); asserts only agent entries survive and new field names round-trip.manifest with only gallery entries returns empty.HTTP error,invalid JSON,empty arraycases retained.Coordination
https://aka.ms/foundry-agents→ awesome-azdtemplates.jsonraw URL (owner: @therealjohn) to coincide with this PR''s release.Test plan
go test ./...incli/azd/extensions/azure.ai.agents— all packages green.go vet ./...clean.azd ai agent initonce redirect is repointed (post-merge).Risks
Cutover coordination: until the redirect is repointed, both PRs are dormant. After repoint, older CLI versions (still on the singular-field schema) will start receiving the new mixed array and fail. Recommend a CLI release immediately after redirect change, plus an
azdminimum-version note in the awesome-azd PR.